package com.yyhh.helpcall.activity;


import android.view.MenuItem;

import androidx.appcompat.app.AppCompatActivity;

public class BaseActivity extends AppCompatActivity {

    public static final String TAG = "progress_dialog_tag";
    protected ProgressDialogFragment progressDialogFragment = new ProgressDialogFragment();

    protected void showProgressDialog(){
        progressDialogFragment.setMessageText("加载中...");
        progressDialogFragment.show(getSupportFragmentManager(),TAG);
    }

    protected void showProgressDialog(String messageText){
        progressDialogFragment.setMessageText(messageText);
        progressDialogFragment.show(getSupportFragmentManager(),TAG);
    }

    protected void hiddenProgressDialog(){
        progressDialogFragment.dismiss();
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if(item.getItemId() == android.R.id.home){
            finish();
        }
        return super.onOptionsItemSelected(item);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}
